package com.atguigu.flink.chapter05.source;

import com.atguigu.flink.bean.WaterSensor;
import org.apache.flink.streaming.api.datastream.DataStreamSource;
import org.apache.flink.streaming.api.environment.StreamExecutionEnvironment;

import java.util.ArrayList;

/**
 * @Author lizhenchao@atguigu.cn
 * @Date 2021/9/14 11:12
 */
public class Flink01_Source_List {
    public static void main(String[] args) throws Exception {
        StreamExecutionEnvironment env = StreamExecutionEnvironment.getExecutionEnvironment();
    
        ArrayList<WaterSensor> list = new ArrayList<>();
        list.add(new WaterSensor("sensor_1", 1L, 10));
        list.add(new WaterSensor("sensor_2", 2L, 20));
        list.add(new WaterSensor("sensor_1", 3L, 30));
    
//        DataStreamSource<WaterSensor> stream = env.fromCollection(list);
        DataStreamSource<Integer> stream = env.fromElements(10, 20, 30, 40);
        stream.print();
    
        env.execute();
    }
}
